package com.example.big_job;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.example.big_job.Dao.Dao;

public class StoreActivity extends AppCompatActivity {
    private Button storeDiancan;
    private Button returnMeau;
    public String storeAddress;
    private RadioGroup radioGroup;
    private RadioButton store1;
    private RadioButton store2;
    private RadioButton store3;
    private RadioButton store4;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_store);

        storeDiancan=findViewById(R.id.b_s);
        returnMeau=findViewById(R.id.b_r);
        radioGroup=(RadioGroup) findViewById(R.id.rg);
        store1=(RadioButton)findViewById(radioGroup.getCheckedRadioButtonId());
        store2=(RadioButton)findViewById(radioGroup.getCheckedRadioButtonId());
        store3=(RadioButton)findViewById(radioGroup.getCheckedRadioButtonId());
        store4=(RadioButton)findViewById(radioGroup.getCheckedRadioButtonId());


        returnMeau.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=null;
                intent=new Intent(StoreActivity.this,MeauActivity.class);
                startActivity(intent);
            }
        });
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radio, int i) {


                storeAddress="城市学院总店";
                if (i==R.id.rb_1){
                    storeAddress="城市学院总店";
                }else if(i==R.id.rb_2){
                    storeAddress="西湖店";
                }else if(i==R.id.rb_3){
                    storeAddress="下沙店";
                }
                else if(i==R.id.rb_4){
                    storeAddress="机场店";
                }
                Dao.setStoreaddress(storeAddress);
                Log.i("TAG",Dao.getStoreaddress());
            }
        });
        storeDiancan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent=null;
                intent=new Intent(StoreActivity.this,FoodActivity.class);
                startActivity(intent);
            }
        });
    }
}